<template>
  <div class="box">
   

    <div class="flex-1 h-0">
      <slot></slot>
    </div>

    
  </div>
</template>
<script setup>
import { ref, nextTick } from "vue";
const emit = defineEmits(["update:modelValue", "confirm", "change"]);






defineExpose({});
</script>

<style lang="scss" scoped>


.box {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
 
}
</style>

<!-- <template>
  <tk-input
    ref="myInput1"
    class="un-input"
    :allowEdit="true"
    @input="input"
    @blur="onBlur"
    v-model="props.modelValue"
    @confirm="onInput1Confirm"
  />
</template>
<script setup>
import {onShow} from '@dcloudio/uni-app'
import { ref, nextTick } from "vue";

const props = defineProps({
  modelValue: {
    type: String,
    default: "",
  },
  // 禁止失去焦点
  noFocus: {
    type: Boolean,
    default: true,
  },
});
const emits = defineEmits(["update:modelValue", "inputChange"]);
const myInput1 = ref();


onShow(()=> {
  console.log(myInput1.value)
  nextTick(()=> {
    myInput1.value?.hideKeyboard()
  })
})

// 扫码枪逻辑------------
// 默认不让失去焦点，为了获取扫码枪数据，
// 如果手动点击输入框则显示键盘，监听input事件获取数据。当键盘隐藏时清空数据，每次失去焦点都清空下数据。防止是因为键盘隐藏导致的失去焦点。

function input(e) {
  emits("inputChange", e, myInput1.value.currentshowKeyboard);
}

function onBlur() {
  // 不能失去焦点
  console.log("失去焦点", myInput1.value);
  if (props.noFocus) myInput1.value.focus();
}
function onInput1Confirm(val) {
  console.log("val ************: ", val);

  // 发起查询，清空输入框
  setTimeout(() => {

  }, 3000);
}
// 扫码枪逻辑------------
</script> -->
